package us.ajg0702.leaderboards.libs.hikari.util;

import java.util.concurrent.TimeUnit;


public interface ClockSource {
    ClockSource CLOCK = Factory.create();
    TimeUnit[] TIMEUNITS_DESCENDING = new TimeUnit[]{TimeUnit.DAYS, TimeUnit.HOURS, TimeUnit.MINUTES, TimeUnit.SECONDS, TimeUnit.MILLISECONDS, TimeUnit.MICROSECONDS, TimeUnit.NANOSECONDS};
    String[] TIMEUNIT_DISPLAY_VALUES = new String[]{"ns", "µs", "ms", "s", "m", "h", "d"};

    static long currentTime() {
        return CLOCK.currentTime0();
    }

    static long toMillis(long time) {
        return CLOCK.toMillis0(time);
    }

    static long toNanos(long time) {
        return CLOCK.toNanos0(time);
    }

    static long elapsedMillis(long startTime) {
        return CLOCK.elapsedMillis0(startTime);
    }

    static long elapsedMillis(long startTime, long endTime) {
        return CLOCK.elapsedMillis0(startTime, endTime);
    }

    static long elapsedNanos(long startTime) {
        return CLOCK.elapsedNanos0(startTime);
    }

    static long elapsedNanos(long startTime, long endTime) {
        return CLOCK.elapsedNanos0(startTime, endTime);
    }

    static long plusMillis(long time, long millis) {
        return CLOCK.plusMillis0(time, millis);
    }

    static TimeUnit getSourceTimeUnit() {
        return CLOCK.getSourceTimeUnit0();
    }

    static String elapsedDisplayString(long startTime, long endTime) {
        return CLOCK.elapsedDisplayString0(startTime, endTime);
    }

    long currentTime0();

    long toMillis0(long paramLong);

    long toNanos0(long paramLong);

    long elapsedMillis0(long paramLong);

    long elapsedMillis0(long paramLong1, long paramLong2);

    long elapsedNanos0(long paramLong);

    long elapsedNanos0(long paramLong1, long paramLong2);

    long plusMillis0(long paramLong1, long paramLong2);

    TimeUnit getSourceTimeUnit0();

    default String elapsedDisplayString0(long startTime, long endTime) {
        long elapsedNanos = elapsedNanos0(startTime, endTime);

        StringBuilder sb = new StringBuilder((elapsedNanos < 0L) ? "-" : "");
        elapsedNanos = Math.abs(elapsedNanos);

        for (TimeUnit unit : TIMEUNITS_DESCENDING) {
            long converted = unit.convert(elapsedNanos, TimeUnit.NANOSECONDS);
            if (converted > 0L) {
                sb.append(converted).append(TIMEUNIT_DISPLAY_VALUES[unit.ordinal()]);
                elapsedNanos -= TimeUnit.NANOSECONDS.convert(converted, unit);
            }
        }

        return sb.toString();
    }

    class Factory {
        private static ClockSource create() {
            String os = System.getProperty("os.name");
            if ("Mac OS X" .equals(os)) {
                return new ClockSource.MillisecondClockSource();
            }

            return new ClockSource.NanosecondClockSource();
        }
    }


    final class MillisecondClockSource
            implements ClockSource {
        public long currentTime0() {
            return System.currentTimeMillis();
        }


        public long elapsedMillis0(long startTime) {
            return System.currentTimeMillis() - startTime;
        }


        public long elapsedMillis0(long startTime, long endTime) {
            return endTime - startTime;
        }


        public long elapsedNanos0(long startTime) {
            return TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis() - startTime);
        }


        public long elapsedNanos0(long startTime, long endTime) {
            return TimeUnit.MILLISECONDS.toNanos(endTime - startTime);
        }


        public long toMillis0(long time) {
            return time;
        }


        public long toNanos0(long time) {
            return TimeUnit.MILLISECONDS.toNanos(time);
        }


        public long plusMillis0(long time, long millis) {
            return time + millis;
        }


        public TimeUnit getSourceTimeUnit0() {
            return TimeUnit.MILLISECONDS;
        }
    }


    class NanosecondClockSource
            implements ClockSource {
        public long currentTime0() {
            return System.nanoTime();
        }


        public long toMillis0(long time) {
            return TimeUnit.NANOSECONDS.toMillis(time);
        }


        public long toNanos0(long time) {
            return time;
        }


        public long elapsedMillis0(long startTime) {
            return TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
        }


        public long elapsedMillis0(long startTime, long endTime) {
            return TimeUnit.NANOSECONDS.toMillis(endTime - startTime);
        }


        public long elapsedNanos0(long startTime) {
            return System.nanoTime() - startTime;
        }


        public long elapsedNanos0(long startTime, long endTime) {
            return endTime - startTime;
        }


        public long plusMillis0(long time, long millis) {
            return time + TimeUnit.MILLISECONDS.toNanos(millis);
        }


        public TimeUnit getSourceTimeUnit0() {
            return TimeUnit.NANOSECONDS;
        }
    }
}


*Location:D:\User\Xuan\Downloads\ajLeaderboards-1.3.3.jar\\us\ajg0702\leaderboards\libs\hikar\\util\ClockSource.class
 *Java compiler version:8(52.0)
         *JD-Core Version:1.1.3
